using System;

namespace Exercise2assignment
{
    class Program
    { 

        static void Main(string[] args)
        {

                double x = 0;
                bool lenght = false;
                while (lenght == false)
                {
                    Console.Clear();
                    try
                    {
                        Console.WriteLine("How long is x? please enter it in cm :");
                        x = double.Parse(Console.ReadLine());
                    }
                    catch
                    {
                        Console.WriteLine("Error! Wrong value format, press ok...");
                        Console.ReadKey();             
                    }
                    {
                    if (x > 7)
                        lenght = true;
                    else
                    {
                        lenght = false;
                        Console.WriteLine("Value of x must been greater than 7cm");
                        Console.ReadKey();
                    }
                    }   
                }
                 double y = 0;
                bool height = false;
                while (height == false)
                {
                    Console.Clear();
                    try
                    {
                        Console.WriteLine("How long is y?:");
                        y = double.Parse(Console.ReadLine());
                    }
                    catch
                    {
                        Console.WriteLine("Error! Wrong value, press ok...");
                        Console.ReadKey();
                    }
                    {
                    if (y > 3)
                        height = true;
                    else
                    {
                        height = false;
                        Console.WriteLine("Value of y must been greater than 3 cm. Press ok...");
                        Console.ReadKey();
                    }
                    }
                }   
            double area = (x * y) - ((2 * 2) - ((y - 3) * 7)) ;
            Console.WriteLine("The area of the shaded region is {0} cm2", area);

            Console.ReadKey();

           
        }
    }
}

